home *** CD-ROM | disk | FTP | other *** search
- #include "GetValue.h"
-
- //////////////////////////////////////////////
- //
- // GetImmediateValue
- //
- //////////////////////////////////////////////
- UInt8 GetImmediateValue(void)
- {
- UInt8* curbyte = gStartofProg + pc++;
- return *curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetAbsoluteValue
- //
- //////////////////////////////////////////////
- UInt8 GetAbsoluteValue(void)
- {
- UInt8* curbyte = GetAbsoluteAddress();
- return *curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetZeroPageValue
- //
- //////////////////////////////////////////////
- UInt8 GetZeroPageValue(void)
- {
- UInt8* curbyte = GetZeroPageAddress();
- return *curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetZeroPageXValue
- //
- //////////////////////////////////////////////
- UInt8 GetZeroPageXValue(void)
- {
- UInt8* curbyte = GetZeroPageXAddress();
- return *curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetZeroPageYValue
- //
- //////////////////////////////////////////////
- UInt8 GetZeroPageYValue(void)
- {
- UInt8* curbyte = GetZeroPageYAddress();
- return *curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetIndXValue
- //
- //////////////////////////////////////////////
- UInt8 GetIndXValue(void)
- {
- UInt8* curbyte = GetIndXAddress();
- return *curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetIndYValue
- //
- //////////////////////////////////////////////
- UInt8 GetIndYValue(void)
- {
- UInt8* curbyte = GetIndYAddress();
- return *curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetAbsoluteXValue
- //
- //////////////////////////////////////////////
- UInt8 GetAbsoluteXValue(void)
- {
- UInt8* curbyte = GetAbsoluteXAddress();
- return *curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetAbsoluteYValue
- //
- //////////////////////////////////////////////
- UInt8 GetAbsoluteYValue(void)
- {
- UInt8* curbyte = GetAbsoluteYAddress();
- return *curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetRelativeValue
- //
- //////////////////////////////////////////////
- UInt8 GetRelativeValue(void)
- {
- UInt8* curbyte = gStartofProg + pc++;
- return *curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetAbsoluteAddress
- //
- //////////////////////////////////////////////
- UInt8* GetAbsoluteAddress(void)
- {
- UInt8* curbyte = gStartofProg + pc++;
- UInt16 addr = *curbyte;
-
- curbyte = gStartofProg + pc++;
- addr |= (((UInt16)*curbyte) << 8);
- return gStartofProg + addr;
- }
-
- //////////////////////////////////////////////
- //
- // GetAbsoluteYAddress
- //
- //////////////////////////////////////////////
- UInt8* GetAbsoluteYAddress(void)
- {
- UInt8* curbyte = gStartofProg + pc++;
- UInt16 addr = *curbyte;
-
- curbyte = gStartofProg + pc++;
- addr |= (((UInt16)*curbyte) << 8);
- addr += regY;
- curbyte = gStartofProg + addr;
- return curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetZeroPageAddress
- //
- //////////////////////////////////////////////
- UInt8* GetZeroPageAddress(void)
- {
- UInt16 addr = 0;
- UInt8* curbyte;
-
- curbyte = ((UInt8*)gStartofProg) + pc++;
- addr |= *curbyte;
- return ((UInt8*)gPageZero) + addr;
- }
-
- //////////////////////////////////////////////
- //
- // GetAccumulatorAddress
- //
- //////////////////////////////////////////////
- UInt8* GetAccumulatorAddress(void)
- {
- return ®A;
- }
-
- //////////////////////////////////////////////
- //
- // GetZeroPageXAddress
- //
- //////////////////////////////////////////////
- UInt8* GetZeroPageXAddress(void)
- {
- UInt16 addr = 0;
- UInt8* curbyte;
-
- curbyte = ((UInt8*)gStartofProg) + pc++;
- addr |= *curbyte;
-
- addr += regX;
- curbyte = ((UInt8*)gPageZero) + addr;
- return curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetZeroPageYAddress
- //
- //////////////////////////////////////////////
- UInt8* GetZeroPageYAddress(void)
- {
- UInt16 addr = 0;
- UInt8* curbyte;
-
- curbyte = ((UInt8*)gStartofProg) + pc++;
- addr |= *curbyte;
-
- addr += regY;
- curbyte = ((UInt8*)gPageZero) + addr;
- return curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetAbsoluteXAddress
- //
- //////////////////////////////////////////////
- UInt8* GetAbsoluteXAddress(void)
- {
- UInt8* curbyte = gStartofProg + pc++;
- UInt16 addr = *curbyte;
-
- curbyte = gStartofProg + pc++;
- addr |= (((UInt16)*curbyte) << 8);
-
- addr += regX;
-
- curbyte = gStartofProg + addr;
- return curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetIndXAddress
- //
- //////////////////////////////////////////////
- UInt8* GetIndXAddress(void)
- {
- UInt8 opByte;
- UInt16 addr = 0;
- UInt8* curbyte;
-
- curbyte = ((UInt8*)gStartofProg) + pc++;
- opByte = *curbyte;
- opByte += regX;
- addr = *(((UInt8*)gPageZero) + opByte);
- addr |= (((UInt16)*(gPageZero + (opByte + 1))) << 8);
-
- curbyte = gStartofProg + addr;
- return curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetIndYAddress
- //
- //////////////////////////////////////////////
- UInt8* GetIndYAddress(void)
- {
- UInt8 opByte;
- UInt16 addr = 0;
- UInt8* curbyte;
-
- curbyte = ((UInt8*)gStartofProg) + pc++;
- opByte = *curbyte;
- addr = *(gPageZero + opByte);
- addr |= (((UInt16)*(gPageZero + (opByte + 1))) << 8);
- addr += regY;
- curbyte = gStartofProg + addr;
- return curbyte;
- }
-
- //////////////////////////////////////////////
- //
- // GetAbsolutePCAddress
- //
- //////////////////////////////////////////////
- UInt16 GetAbsolutePCAddress(void)
- {
- UInt8* curbyte = gStartofProg + pc++;
- UInt16 addr = *curbyte;
-
- curbyte = gStartofProg + pc++;
- addr |= (((UInt16)*curbyte) << 8);
- return addr;
- }
-
- //////////////////////////////////////////////
- //
- // GetIndirectPCAddress
- //
- //////////////////////////////////////////////
- UInt16 GetIndirectPCAddress(void)
- {
- UInt16 addr;
- UInt16* newAdder;
-
- addr = (UInt16) GetAbsolutePCAddress();
- newAdder = (UInt16*) (gStartofProg + addr);
- addr = ((*newAdder) << 8) | ((*newAdder) >> 8);
- return addr;
- }
-